// import type { FormRules } from 'element-plus'
type ICategory = 'system' | 'crm'

export type IAlign = 'left' | 'center' | 'right'

type IPageName =
  | 'user'
  | 'role'
  | 'department'
  | 'menu'
  | 'company'
  | 'employee'

/**
 * 配置基本类型
 */
export interface IConfigBase<T> {
  /** 页面名称 */
  pageName: IPageName
  /** store 名称 */
  category: ICategory
  /** 组件元素配置 */
  propItems: T[]
}

export interface IResetPwd {
  oldPwd: string
  newPwd: string
  confirmPwd: string
}

type ITrigger = 'blur' | 'change'

interface IRlueBase {
  message: string
  trigger: ITrigger | ITrigger[]
}

type IRequiredRule = IRlueBase & {
  required: boolean
}

type IRegexpRule = IRlueBase & {
  type?: 'regexp'
  pattern: RegExp
}
type IEnumRule = IRlueBase & {
  type: 'enum'
  enum: string[] | boolean[]
  required?: boolean
}

type numberRule = IRlueBase & {
  min: number
  max: number
}

type typeRule = IRlueBase & {
  type:
    | 'string'
    | 'number'
    | 'integer'
    | 'float'
    | 'boolean'
    | 'array'
    | 'date'
    | 'email'
    | 'any'
    | 'object'
    | 'hex'
}

export type IRule =
  | IRequiredRule
  | IRegexpRule
  | numberRule
  | typeRule
  | IEnumRule

// export interface IRules {
//   required?: boolean
//   message: string
//   trigger: ITrigger | ITrigger[]
//   type?: string
//   regexp?: RegExp
// }
// export type IRules = FormRules | FormRules[]
